C#

推荐列表 站点导航

当前位置:首页 > 脚本编程 > C# >

C#_C#彩色图片灰度化算法实例,本文实例讲述了C#彩色图片灰

来源:网络整理  作者:  发布时间:2020-12-22 01:39
C#彩色图片灰度化算法实例,本文实例讲述了C#彩色图片灰度化实现方法。分享给大家供大家参考。具体方法如下:主要...

g.DrawImage(original, new Rectangle(0, 0, original.Width, original.Height), 0, 0, original.Width, original.Height, GraphicsUnit.Pixel, attributes);

{

//using the grayscale color matrix

new float[] {.11f, .11f, .11f, 0, 0},

//draw the original image on the new image

//create some image attributes

System.Drawing.Imaging.ColorMatrix colorMatrix = new System.Drawing.Imaging.ColorMatrix(

Graphics g = Graphics.FromImage(newBitmap);

});

Bitmap newBitmap = new Bitmap(original.Width, original.Height);

public static Bitmap MakeGrayscale(Bitmap original)

复制代码 代码如下:

//create a blank bitmap the same size as original

new float[] {0, 0, 0, 1, 0},

new float[] {.3f, .3f, .3f, 0, 0},

//set the color matrix attribute

主要功能代码如下:

//get a graphics object from the new image

new float[][]

attributes.SetColorMatrix(colorMatrix);

//create the grayscale ColorMatrix

new float[] {.59f, .59f, .59f, 0, 0},

//dispose the Graphics object

System.Drawing.Imaging.ImageAttributes attributes = new System.Drawing.Imaging.ImageAttributes();

{

new float[] {0, 0, 0, 0, 1}

相关热词: C# 实例

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://v30.fanwenzhu.com/jiaob/c/6901.shtml

最新文章
热门文章
Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

C#_C#彩色图片灰度化算法实例,本文实例讲述了C#彩色图片灰

2020-12-22 编辑:

g.DrawImage(original, new Rectangle(0, 0, original.Width, original.Height), 0, 0, original.Width, original.Height, GraphicsUnit.Pixel, attributes);

{

//using the grayscale color matrix

new float[] {.11f, .11f, .11f, 0, 0},

//draw the original image on the new image

//create some image attributes

System.Drawing.Imaging.ColorMatrix colorMatrix = new System.Drawing.Imaging.ColorMatrix(

Graphics g = Graphics.FromImage(newBitmap);

});

Bitmap newBitmap = new Bitmap(original.Width, original.Height);

public static Bitmap MakeGrayscale(Bitmap original)

复制代码 代码如下:

//create a blank bitmap the same size as original

new float[] {0, 0, 0, 1, 0},

new float[] {.3f, .3f, .3f, 0, 0},

//set the color matrix attribute

主要功能代码如下:

//get a graphics object from the new image

new float[][]

attributes.SetColorMatrix(colorMatrix);

//create the grayscale ColorMatrix

new float[] {.59f, .59f, .59f, 0, 0},

//dispose the Graphics object

System.Drawing.Imaging.ImageAttributes attributes = new System.Drawing.Imaging.ImageAttributes();

{

new float[] {0, 0, 0, 0, 1}

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://v30.fanwenzhu.com/jiaob/c/6901.shtml

相关文章

风云图片

推荐阅读

返回C#频道首页